1   package uba.db.column;
2   
3   import junit.framework.TestCase;
4   import uba.db.testhelpers.TestUtils;
5   
6   /***
7    * Test de unidad para {@linkk NumericColumnSpecification}.
8    * 
9    * @version $Revision: 1.2 $
10   */
11  public class IntegerColumnSpecificationTest extends TestCase {
12      private IntegerColumnSpecification columnSpec;
13      private IntegerColumnSpecification sameColumnSpec;
14      private IntegerColumnSpecification otherColumnSpec;
15  
16      /***
17       * @see junit.framework.TestCase#setUp()
18       */
19      protected void setUp() throws Exception {
20          super.setUp();
21          columnSpec = new IntegerColumnSpecification("id", ColumnConstraint.NOT_NULL);
22          sameColumnSpec = new IntegerColumnSpecification("id", ColumnConstraint.NOT_NULL);
23          otherColumnSpec = new IntegerColumnSpecification("other");
24  
25      }
26      /***
27       * Test de igualdad entre dos instancias
28       */
29      public void testEquals() throws Exception {
30          TestUtils.assertEqualsImplementation(columnSpec,
31                                               sameColumnSpec,
32                                               otherColumnSpec);
33      }
34      
35      /***
36       * Test del metodo notNull
37       */
38      public void testNotNull() throws Exception {
39          assertTrue(columnSpec.notNull());
40          assertFalse(otherColumnSpec.notNull());
41      }
42      
43      /***
44       * Test: retornar un string que describe el tipo de datos de la especificación de
45       * columna.
46       */
47      public void testDataTypeDisplayString() throws Exception {
48          assertEquals(IntegerColumnSpecification.DATATYPE_DISPLAY_STRING, columnSpec
49                  .dataTypeDisplayString());
50      }
51  }